package shajie.shajun.mmhf.Service;

import android.app.Notification;
import android.app.NotificationManager;
import android.app.Service;
import android.content.Intent;
import android.os.Handler;
import android.os.IBinder;

public class MyService extends Service {
    private Handler mHandler = new Handler();
    private Runnable r;
    private   Notification notification;
    private NotificationManager manager;
    public MyService() {
    }
    @Override
    public IBinder onBind(Intent intent) {
        // TODO: Return the communication channel to the service.
        throw new UnsupportedOperationException("Not yet implemented");
    }
    @Override
    public void onCreate() {
        super.onCreate();
//         manager =
//                (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
////        PendingIntent contentIntent = PendingIntent.getActivity(
////                this, 0, new Intent(this, ResultActivity.class), 0);
//
//         notification = new NotificationCompat.Builder(this)
//                .setContentText("通知内容")
//                .setContentTitle("通知标题")
//                .setSmallIcon(android.R.mipmap.sym_def_app_icon)
//                .setLargeIcon(BitmapFactory.decodeResource(getResources(), R.drawable.bg_spinner_default))
//                .setWhen(System.currentTimeMillis())
//                .build();
//                r = new Runnable() {
//                    int n=0;
//            @Override
//            public void run() {
////do something
////每隔1s循环执行run方法
//// 内容
//                n++;
//                manager.notify(1,notification);
//                mHandler.postDelayed(this, 2000);
//            }
//        };
//        mHandler.postDelayed(r, 1000);//1秒后启动计时器
//   //     mHandler.removeCallbacks(r);//结束计时器
    }
}
